package displayboardinfo.tests;

import java.io.FileReader;
import java.io.FileWriter;
import java.io.Writer;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;

public class XMLTests {
	public static void main(String[] args) {

		
//		JAXBContext context = JAXBContext.newInstance(BookStore.class);
//		Marshaller m = context.createMarshaller();
//		m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
//		m.marshal(bookstore, System.out);

//				Writer w = null;
//				try {
//					w = new FileWriter(BOOKSTORE_XML);
//					m.marshal(bookstore, w);
//				} finally {
//					try {
//						w.close();
//					} catch (Exception e) {
//					}
//				}
//
//				// get variables from our xml file, created before
//				System.out.println();
//				System.out.println("Output from our XML File: ");
//				Unmarshaller um = context.createUnmarshaller();
//				BookStore bookstore2 = (BookStore) um.unmarshal(new FileReader(
//						BOOKSTORE_XML));
//
//				for (int i = 0; i < bookstore2.getBooksList().toArray().length; i++) {
//					System.out.println("Book " + (i + 1) + ": "
//							+ bookstore2.getBooksList().get(i).getName() + " from "
//							+ bookstore2.getBooksList().get(i).getAuthor());
//				}
	}
}
